﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GS.Cricket.Service.Impl.NHibernate;

namespace GS.Cricket.Service.Impl
{
    public class GroupService : IGroupService
    {

        #region IGroupService Members

        public int Add(Entities.Group group)
        {
            return (int)group.Add<Entities.Group>();
        }

        public void Update(Entities.Group group)
        {
            group.Update<Entities.Group>();
        }
        
        public void Delete(int groupId)
        {
            var existing = (Entities.Group)groupId.GetById<Entities.Group>();
            if (existing != null)
            {
                existing.Delete<Entities.Group>();
            }
        }

        public IEnumerable<Entities.Group> GetAll()
        {
            return this.GetAll<Entities.Group>();
        }


        public Entities.Group GetById(int groupId)
        {
            return (Entities.Group)groupId.GetById<Entities.Group>();
        }

        #endregion
    }
}
